package edu.vt.ece_3574.amber_alert.AlertSettings;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.util.Log;


public class Battery {
	private static final String TAG = Battery.class.getSimpleName();
	
	private static int batlev;	
	private static int setbat;
	private static String batstatus = "off";
	
	
	private static BroadcastReceiver LowBatReceive = new BroadcastReceiver() {		
		@Override
		public void onReceive(Context bat, Intent I) {
			batlev = I.getIntExtra("level", 0);	
			Log.d(TAG, "Battery Level Received: " + batlev);
		}
		
	};
	
	public static BroadcastReceiver get() {
		return LowBatReceive;
	}
	
	public static void setBatLevel(String level){
		setbat = Integer.parseInt(level);		
	}
	
	public static boolean BatLevel(){
		if(batlev < setbat){
			return false;
		}
		else{
			return true;
		}
	}	
	
	public static int getSetLevel(){
		return setbat;
	}
	
	public static void BatStatus(String status){
		
		batstatus = status;
	}
	
	public static boolean BatisOn(){
		if(batstatus.equals("on")){
			return true;
		}
		return false;
	}	
	
}

